import { createApp } from 'vue'
import App from './App.vue'
import 'virtual:windi.css'
import { createPinia } from 'pinia'
import { router } from '@/router'
// 引入全局路由前置守卫文件
import '@/permission.js'
import 'nprogress/nprogress.css'
// 持久化存储
import piniaPersist from 'pinia-plugin-persist'

// 创建pinia
const pinia = createPinia()
pinia.use(piniaPersist)
//创建根实例
const app = createApp(App)

//全局引入elemtPlus中的icon图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
//整个应用使用路由、pinia
app.use(router).use(pinia)

//挂载根实例
app.mount('#app')
